package com.lht.testDemo;

import org.junit.Test;

import java.util.Calendar;

/**
 * @author Eric
 * @version 1.0
 * @date 2019-11-16
 */
public class CalenderTest {

    /**
     * 修改成周一为 每周开始，并且获取到本周周一凌晨时间
     *
     * @return void
     * @throws
     * @author Eric
     * @date 2019/11/16
     **/
    @Test
    public void test11() {

//        Calendar calendar = Calendar.getInstance();
//        calendar.set(Calendar.HOUR_OF_DAY, 0);
//        calendar.set(Calendar.MINUTE, 0);
//        calendar.set(Calendar.SECOND, 0);
//        calendar.set(Calendar.MILLISECOND, 0);
//
//        calendar.set(Calendar.DAY_OF_WEEK, 2);
//
//
//        System.out.println(calendar.getTimeInMillis());
//        System.out.println(calendar.getTime());

        System.out.println(Demo.A.name());
    }


    public enum Demo {
        A;
    }

    @Test
    public void testEqual() {
        Calendar b = Calendar.getInstance();
        Calendar a = Calendar.getInstance();
        cleanHourAndSecond(b);
        cleanHourAndSecond(a);
        System.out.println("是否相同 => " + b.equals(a));
    }

    /**
     * @param calendar
     * @return void
     * @throws
     * @author Eric
     * @date 2020/1/9
     **/
    public static void cleanHourAndSecond(Calendar calendar) {
        calendar.set(Calendar.HOUR_OF_DAY, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
    }
}
